<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>SB Admin 2 - Bootstrap Admin Theme</title>
    <!-- Bootstrap Core CSS -->
    <link href="/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="/assets/sbadmin2/css/sb-admin-2.css" rel="stylesheet">
    <!-- Custom Fonts -->
    <link href="/assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<!--[if lt IE 9]><script src="/assets/h5support/ie8-responsive-file-warning.js"></script><![endif]-->
	<script src="/assets/h5support/ie-emulation-modes-warning.js"></script>
	<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
	<!--[if lt IE 9]>
	<script src="/assets/h5support/html5shiv.min.js"></script>
	<script src="/assets/h5support/respond.min.js"></script>
	<![endif]-->
</head>
<body>

    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">请登录</h3>
                    </div>
                    <div class="panel-body">
                         <fieldset>
                             <div class="form-group">
                                 <input class="form-control" placeholder="E-mail" id="username" name="username" type="email" value="admin@qq.com" autofocus>
                             </div>
                             <div class="form-group">
                                 <input class="form-control" placeholder="Password" id="password" name="password" type="password" value="123123">
                             </div>
                             <div class="checkbox">
                                 <label>
                                     <input name="remember" type="checkbox" value="Remember Me">记住我
                                 </label>
                             </div>
                             <!-- Change this to a button or input when using this as a form -->
                             <a id="lgbtn" class="btn btn-lg btn-success btn-block">登录</a>
                         </fieldset>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- jQuery -->
    <script src="/assets/jquery/jquery.min.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="/assets/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript">
  $(function(){
	$("#lgbtn").on('click', function(e) {
		if ($("#username").val() == "" || $("#password").val() == "") {
			alert("用户名和密码不能为空！");
		} else {
			$.post("/adminlogin?v=" + Math.random(), {
				username : $("#username").val(),
				password : $("#password").val()
			}, function(data) {
				if (data.msg == 'success') {
					window.location = "/admin/center";
				} else {
					alert(data.msg);
				}
			});
		}
		e.preventDefault();
	});
  });
</script>
</body>

</html>
